<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    {block name="title"}<title id="title"></title>{/block}
    <meta name="keywords" content="知果汇"/>
    <meta name="description" content="知果汇"/>
    <link rel="SHORTCUT ICON" href="_IMG_/favicon.ico"/>
    <link rel="stylesheet" type="text/css" href="_CSS_/reset.css">
    <link rel="stylesheet" type="text/css" href="_CSS_/common.css">
    <link rel="stylesheet" type="text/css" href="_CSS_/slide.css">

    {block name="css"}
    <style>
        #submit_keyword {
            cursor: pointer;
        }
    </style>
    {/block}
    <!--[if lt IE 9]>
    <script src="http://www.ijquery.cn/js/html5shiv.js"></script>

    <![endif]-->
</head>

<body>
<div class="wrapper">
    <!-- 顶部区域 -->
    {include file="/common/header" /}
     <!-- 搜索 -->
    {include file="/common/search" /}
	<!-- 导航 -->
	{block name="navbar"}{/block}
    <!-- 主体内容 -->
    {block name="content"}{/block}
    <!-- 底部信息 -->
    {include file="/common/footer" /}
</div>
<!-- 脚本引入 -->
<script src="_JS_/jquery-1.8.3.min.js"></script>
<script src="_JS_/jquery.base64.js"></script>
<script src="_JS_/jquery.cookie.js"></script>
<script src="_JS_/jquery.SuperSlide.2.1.2.js"></script>
<script src="_JS_/common.js"></script>
<script type="text/javascript" src="_JS_/getDate.js"></script>
<script src="_JS_/search.js"></script>
<script>
       $(function () {
        $.ajax({
            type: 'get',
            url: "{:url('api/keyword/index')}",
            dataType: 'jsonp',
            success: function (msg) {
                if (msg.code == 200) {
                    if (msg.data.length == 0) {
                        var html = '<a class="searchItem fl" href="javascript:;">国内专利申请</a>' +
                            '<a class="searchItem fl" href="javascript:;">专利许可</a>' +
                            '<a class="searchItem fl" href="javascript:;">科研项目研究</a>' +
                            '<a class="searchItem fl" href="javascript:;">政府项目管理</a>';
                        $(".hotSearch").html(html);
                    } else {
                        var html = '';
                        for (var i = 0; i < msg.data.length; i++) {
                            html += '<a class="searchItem fl" href="javascript:;">' + msg.data[i].keyword + '</a>';
                        }
                        $(".hotSearch").html(html);
                    }
                } else {
                    layer.msg('网络错误！', {icon: 5});
                }
            },
        })
    });

    $(document).on('click', '.searchItem', function () {
        var keyword = $(this).text();
        window.location.href = "{:url('index/search/search_work')}?" + keyword
        getfole(keyword);
    });
    $("#submit_keyword").on('click', function () {
        var keyword = $("#keyword").val();
        window.location.href = "{:url('index/search/search_work')}?" + keyword
        getfole(keyword);
    });


    //回车键绑定搜索
    $(".searchArea").keydown(function (event) {
        if (event.keyCode == 13) {
            var keyword = $("#keyword").val();
            window.location.href = "{:url('index/search/search_work')}?" + keyword
            getfole(keyword);
        }
    });
	  function getfole(keyword) {
        $.ajax({
            type: 'get',
            url: "{:url('api/keyword/keyword')}",
            data: {keyword: keyword},
            dataType: 'jsonp'
        })
    }
</script>
{block name="js"}{/block}
</body>
</html>